package com.rd.student.ruanjian.class4.baiyunyao.DAY0728;
import java.util.Arrays;
import java.util.Random;
public class fangfa {
    public static void main(String[] args) {
        Random r = new Random();
        int[] allArr = new int[50];
        for (int i = 0; i < allArr.length; i++) {
            int num = r.nextInt(50);
            System.out.println();}
            int len = allArr.length;
            int n = 20;
            int[] indexArr = new int[n];
            for (int x = 0; x < n; x++) {
                int index = (int) (Math.random() * len);
                boolean flag = false;
                for (int j = 0; j < x; j++) {
                    if (index == indexArr[j]) {
                        flag = true;
                        break;
                    }
                }
                if (flag) {
                    x--;
                    continue;
                }
                indexArr[x] = index;
                System.out.println(Arrays.toString(indexArr));
            }

    }
}



